

<%@ page import="com.consorzioimpresa.resuite.domain.Agente"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="layout" content="springSecurityUI" />
<g:set var="entityName"
	value="${message(code: 'agente.label', default: 'Agente')}" />
<title>Modifica Agente</title>
</head>
<body>
	<div class="nav">
		<%--            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>--%>
		<span class="menuButton"><g:link class="list" action="list">
				Lista Agenti
			</g:link>
		</span> 
		<span class="menuButton"><g:link class="create"
				action="create">
				Crea Nuovo Agente
			</g:link>
		</span>
	</div>
	<div class="body">
		<h1>
			Modifica Agente
		</h1>
		<g:if test="${flash.message}">
			<div class="message">
				${flash.message}
			</div>
		</g:if>
		<g:hasErrors bean="${agenteInstance}">
			<div class="errors">
				<g:renderErrors bean="${agenteInstance}" as="list" />
			</div>
		</g:hasErrors>
		<g:form method="post">
			<g:hiddenField name="id" value="${agenteInstance?.id}" />
			<g:hiddenField name="version" value="${agenteInstance?.version}" />
			<div class="dialog">
				<table>
					<tbody>

						<tr class="prop">
							<td valign="top" class="name"><label for="agenzia"><g:message
										code="agente.agenzia.label" default="Agenzia" /></label></td>
							<td valign="top"
								class="value ${hasErrors(bean: agenteInstance, field: 'agenzia', 'errors')}">
								<g:textField name="agenzia" value="${agenteInstance?.agenzia}" />
							</td>
						</tr>

						<tr class="prop">
							<td valign="top" class="name"><label for="cellulare"><g:message
										code="agente.cellulare.label" default="Cellulare" /></label></td>
							<td valign="top"
								class="value ${hasErrors(bean: agenteInstance, field: 'cellulare', 'errors')}">
								<g:textField name="cellulare"
									value="${agenteInstance?.cellulare}" />
							</td>
						</tr>

						<tr class="prop">
							<td valign="top" class="name"><label for="cognome"><g:message
										code="agente.cognome.label" default="Cognome" /></label></td>
							<td valign="top"
								class="value ${hasErrors(bean: agenteInstance, field: 'cognome', 'errors')}">
								<g:textField name="cognome" value="${agenteInstance?.cognome}" />
							</td>
						</tr>

						<tr class="prop">
							<td valign="top" class="name"><label for="email"><g:message
										code="agente.email.label" default="Email" /></label></td>
							<td valign="top"
								class="value ${hasErrors(bean: agenteInstance, field: 'email', 'errors')}">
								<g:textField name="email" value="${agenteInstance?.email}" />
							</td>
						</tr>

						<tr class="prop">
							<td valign="top" class="name"><label for="immobili"><g:message
										code="agente.immobili.label" default="Immobili Associati" /></label></td>
							<td valign="top"
								class="value ${hasErrors(bean: agenteInstance, field: 'immobili', 'errors')}">

								<ul>
									<g:each in="${agenteInstance?.immobili?}" var="i">
										<li><g:link controller="immobile" action="show"
												id="${i.id}">
												${i?.encodeAsHTML()}
											</g:link></li>
									</g:each>
								</ul> 
								<p>
								 ------------------------------------------
								</p>
								<g:link controller="immobile" action="create"
									params="['agente.id': agenteInstance?.id]">
									${message(code: 'default.add.label', args: [message(code: 'immobile.label', default: 'Associa Altro Immobile')])}
								</g:link>

							</td>
						</tr>

						<tr class="prop">
							<td valign="top" class="name"><label for="nome"><g:message
										code="agente.nome.label" default="Nome" /></label></td>
							<td valign="top"
								class="value ${hasErrors(bean: agenteInstance, field: 'nome', 'errors')}">
								<g:textField name="nome" value="${agenteInstance?.nome}" />
							</td>
						</tr>

						<tr class="prop">
							<td valign="top" class="name"><label for="skype"><g:message
										code="agente.skype.label" default="Skype" /></label></td>
							<td valign="top"
								class="value ${hasErrors(bean: agenteInstance, field: 'skype', 'errors')}">
								<g:textField name="skype" value="${agenteInstance?.skype}" />
							</td>
						</tr>

						<tr class="prop">
							<td valign="top" class="name"><label for="telefono"><g:message
										code="agente.telefono.label" default="Telefono" /></label></td>
							<td valign="top"
								class="value ${hasErrors(bean: agenteInstance, field: 'telefono', 'errors')}">
								<g:textField name="telefono" value="${agenteInstance?.telefono}" />
							</td>
						</tr>

					</tbody>
				</table>
			</div>
			<div class="buttons">
				<span class="button"><g:actionSubmit class="save"
						action="update"
						value="Salva" /></span>
				<span class="button"><g:actionSubmit class="delete"
						action="delete"
						value="Elimina"
						onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Sei Sicuro?')}');" /></span>
			</div>
		</g:form>
	</div>
</body>
</html>
